import { request } from '../network/request'

export function requestLogin (loginFormData) {
  return request({
    method: 'post',
    url: '/user/login',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: loginFormData
  })
}

export function requestRegister (registerFormData) {
  return request({
    method: 'post',
    url: '/user/register',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: registerFormData
  })
}

export function requestUserInfo () {
  return request({
    method: 'get',
    url: '/user/info'
  })
}

export function requestDeleteOnlineUser (formData) {
  return request({
    method: 'delete',
    url: '/user/online',
    data: formData
  })
}

export function requestGetMoment () {
  return request({
    method: 'get',
    url: '/moment'
  })
}

export function requestUploadArticle (articleFormData) {
  return request({
    method: 'post',
    url: '/moment',
    data: articleFormData
  })
}

export function requestDeleteArticle (articleFormData) {
  return request({
    method: 'delete',
    url: '/moment',
    data: articleFormData
  })
}

// Todo
export function requestAddTodo (todoFormData) {
  return request({
    method: 'post',
    url: '/todo',
    data: todoFormData
  })
}

export function requestChangeTodoStatus (todoFormData) {
  return request({
    method: 'post',
    url: '/todo/check',
    data: todoFormData
  })
}

export function requestDeleteTodo (todoFormData) {
  return request({
    method: 'delete',
    url: '/todo',
    data: todoFormData
  })
}

export function requestEditTodo (todoFormData) {
  return request({
    method: 'post',
    url: '/todo',
    data: todoFormData
  })
}

export function requestGetTodos (time) {
  return request({
    method: 'get',
    url: '/todo',
    params: { time }
  })
}

// 签到
export function requestPunchIn () {
  return request({
    method: 'post',
    url: '/punch'
  })
}

// 获取签到日期
export function requestGetPunchInDays () {
  return request({
    method: 'get',
    url: '/punch'
  })
}
